package com.wefiesta.app.utils;

import android.content.Context;
import android.content.SharedPreferences;


public class Setting {

	private Context mContext = null;
	
	public Setting(Context context) {
		mContext = context;
	}
	
	
	public boolean isLogin() {
		SharedPreferences pref = mContext.getSharedPreferences(StringDefine.Key.WEFIESTA, Context.MODE_PRIVATE);
		
		return pref.getBoolean(StringDefine.Key.IS_LOGIN, false);
	}
	
	public boolean setIsLogin(boolean isLogin) {
		SharedPreferences pref = mContext.getSharedPreferences(StringDefine.Key.WEFIESTA, Context.MODE_PRIVATE);
		
        SharedPreferences.Editor editor = pref.edit();
        editor.putBoolean(StringDefine.Key.IS_LOGIN, isLogin);
        
        return editor.commit();
	}
	
	public boolean isAutoLogin() {
		SharedPreferences pref = mContext.getSharedPreferences(StringDefine.Key.WEFIESTA, Context.MODE_PRIVATE);
		
		return pref.getBoolean(StringDefine.Key.IS_AUTO_LOGIN, false);
	}
	
	public boolean setAutoLogin(boolean isAutoLogin) {
		SharedPreferences pref = mContext.getSharedPreferences(StringDefine.Key.WEFIESTA, Context.MODE_PRIVATE);
		
        SharedPreferences.Editor editor = pref.edit();
        editor.putBoolean(StringDefine.Key.IS_AUTO_LOGIN, isAutoLogin);
        
        return editor.commit();
	}
}